﻿//
// © Algobox Ltd - Benn Eichhorn
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Net;

namespace Algobox.Toolbox.Net.Mail
{
	public class GmailClient
	{
		#region Constructors

		public GmailClient(string username, string password)
		{            
			_smtpClient = new SmtpClient(GMAIL_SERVER, GMAIL_PORT);
			_smtpClient.EnableSsl = true;
			_smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
			_smtpClient.Credentials = new NetworkCredential(username, password);
		}

		#endregion
		//////////////////
		#region Member Variables
				
		private const string GMAIL_SERVER = "smtp.gmail.com";
		private const int GMAIL_PORT = 587;
		
		private SmtpClient _smtpClient;

		#endregion
		//////////////////
		#region Properties



		#endregion
		//////////////////
		#region Functions

		public void SendMail(MailMessage message)
		{
            _smtpClient.SendAsync(message, null);
		}

		public void SendMail(string from, string to, string subject, string message)
		{
            _smtpClient.SendAsync(from, to, subject, message, null);            
		}

		#endregion
		//////////////////
		#region Enums



		#endregion
	}
}
